<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTradingHallsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('trading_halls', function (Blueprint $table) {
            $table->id()->comment('交易ID');
            $table->unsignedBigInteger('user_id')->comment('关联用户');
            $table->tinyInteger('type')->comment('交易类型：1=买入 2=卖出');
            $table->integer('amount')->comment('交易数量');
            $table->decimal('price', 10, 2)->comment('交易单价');
            $table->tinyInteger('status')->default(1)->comment('交易状态 1=待处理 2=已完成 3=已取消');
            $table->timestamp('processed_at')->nullable()->comment('处理时间');
            $table->timestamp('date')->nullable()->comment('交易日期');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `trading_halls` comment '交易大厅'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('trading_halls');
    }
}
